<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--使用EL表达式--%>
<%@page isELIgnored="false" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>欢迎来到 Renew！</title>
</head>
<link rel="stylesheet" type="text/css" href="../css/main.css">
<link rel="stylesheet" type="text/css" href="../css/health-select.css">
<link rel="stylesheet" type="text/css" href="../css/admin.css">
<body onload="initParameter2(${requestScope.openInputView},${requestScope.asideStatus})">
<!--顶栏-->
<header>
    <!--网站顶栏标题-->
    <span id="font">
        <h1 id="first">Re</h1>
        <h1 id="second">new</h1>
    </span>
    <!--网站顶栏头像-->
    <div id="user">
        <img src="../img/user8-128x128.jpg">
        <!--下拉框和点击下拉按钮-->
        <div class="dropdown">
            <span class="dropBtn">root</span>
            <div class="dropdown-content">
                <a href="${pageContext.request.contextPath}/rootLoginOut">退出登录</a>
                <a href="#">个人信息</a>
            </div>
        </div>
    </div>
</header>
<!--边栏-->
<aside>
    <div class="tab_list">
        <ul class="aside">
            <li id="aside1"><a href="${pageContext.request.contextPath}/searchUser">体检参数上传</a></li>
            <li id="aside2"><a href="${pageContext.request.contextPath}/ComboAddServlet">体检预约</a></li>
        </ul>
    </div>
</aside>
<main>
    <div class="tab_con">
        <div class="item" id="item1" style="display: none">
            <form id="bookForm" action="${pageContext.request.contextPath}/searchUser">
                查询用户的预定：
                <div>
                    <select name="searchUserId" id="userIdSelect" onchange="clickOption2()">
                        <option id="#">选择用户的ID</option>
                        <!--varStatus ： 遍历对象的状态-->
                        <c:forEach var="user" items="${requestScope.usersList}" varStatus="i">
                            <c:choose>
                                <c:when test="${requestScope.index == (i.index+1)}">
                                    <option selected id="${user.userId}"
                                            value="${user.userName}">${user.userName}</option>
                                </c:when>
                                <c:otherwise>
                                    <option id="${user.userId}" value="${user.userName}">${user.userName}</option>
                                </c:otherwise>
                            </c:choose>
                        </c:forEach>
                    </select>

                </div>
                <label id="bookTime">查询套餐项：</label>
                <select name="searchItemId" id="itemSelect"
                        onchange="clickOption3(${requestScope.userId},${requestScope.index})">
                    <option id="#">选择套餐</option>
                    <!--varStatus ： 遍历对象的状态-->
                    <c:forEach var="user" items="${requestScope.usersListByCombo}" varStatus="i">
                        <c:forEach var="examineOrder" items="${user.examineOrders}">
                            <c:choose>
                                <c:when test="${requestScope.index1 == (i.index+1)}">
                                    <option selected id="${examineOrder.examineId}"
                                            value="${examineOrder.examineCombo}---${examineOrder.examineDate}">
                                            ${examineOrder.examineCombo}---
                                            ${examineOrder.examineDate}
                                    </option>
                                </c:when>
                                <c:otherwise>
                                    <option id="${examineOrder.examineId}"
                                            value="${examineOrder.examineCombo}---${examineOrder.examineDate}">
                                            ${examineOrder.examineCombo}---
                                            ${examineOrder.examineDate}
                                    </option>
                                </c:otherwise>
                            </c:choose>
                        </c:forEach>
                    </c:forEach>
                </select>
            </form>
            <%--根据用户ID查出来的信息--%>
            <table width="90%" class="table" id="tableAdmin">
                <!--表格头部-->
                <thead>
                <tr>
                    <th>${requestScope.column.column1}</th>
                    <th>${requestScope.column.column2}</th>
                    <th>${requestScope.column.column3}</th>
                    <th>${requestScope.column.column4}</th>
                </tr>
                </thead>
                <c:choose>
                    <c:when test="${requestScope.attributeTableStatus == 1}">
                        <c:forEach var="user" items="${requestScope.usersListByItem}" varStatus="i">
                            <tr>
                                <c:forEach var="examineOrder" items="${user.examineOrders}">
                                    <td>

                                            ${examineOrder.examineId}
                                    </td>
                                    <td>
                                            ${examineOrder.examineCombo}
                                    </td>
                                </c:forEach>

                                <c:forEach var="healthAttributes" items="${user.healthAttributesList}">
                                    <td>
                                            ${healthAttributes.attributeId}
                                    </td>
                                    <td class="attributeRow">
                                            ${healthAttributes.attributeName}
                                        <input type="button" class="updateButton"
                                               onclick="clickUpdate(${i.index},${requestScope.userId},${requestScope.examineDate})"
                                               value="上传" style="width: 50px; height: 30px; ">
                                    </td>
                                </c:forEach>
                            </tr>
                        </c:forEach>
                    </c:when>
                    <c:otherwise>
                        <c:forEach var="user" items="${requestScope.usersListByCombo}">
                            <tr>
                                <c:forEach var="examineOrder" items="${user.examineOrders}">
                                    <td>
                                            ${examineOrder.examineId}
                                    </td>
                                    <td>
                                            ${examineOrder.examineCombo}
                                    </td>

                                    <td>
                                            ${examineOrder.examineDate}
                                    </td>
                                </c:forEach>
                                <td>
                                        ${user.userId}
                                </td>
                            </tr>
                        </c:forEach>
                    </c:otherwise>
                </c:choose>

            </table>

        </div>
        <div class="item" style="display: none" id="item2">
            <div id="table">
                <table class="item" width="90%">
                    <form action="${pageContext.request.contextPath}/ComboAddServlet" method="post">

                        <div id="form">
                            <input class="adminText" type="textbox" name="name" placeholder="请输入套餐名">
                            <input class="adminText" type="textbox" name="price" placeholder="请输入套餐价格">
                            <input id="add" type="submit" value="添加">
                        </div>


                        <tr>
                            <td>
                                <strong>体检项目选择</strong>
                            </td>
                            <td>
                                <strong>体检指标范围</strong>
                            </td>
                        </tr>

                        <c:forEach var="items" items="${comboForm.healthlist}">
                            <tr>
                                <td id="checkboxTd">
                                    <input id="checkbox" type="checkbox" ${items.value.checked?"checked":""}
                                           onclick="updateHealthAttributesByChekedInput(${items.value.attributeId})">
                                        ${items.value.attributeName},${items.value.attributeScope}
                                </td>
                                <td>
                                        ${items.value.attributeScope}
                                </td>
                            </tr>
                        </c:forEach>

                    </form>
                </table>
            </div>
        </div>
    </div>
    <!--体检项输入框页面-->
    <div id="inputView" style="display: none">
        <input type="text" name="attributeText" id="attributeText">
        <input type="button" value="上传"
               onclick="clickInput(${requestScope.userId},${requestScope.attributeId},${requestScope.examineDate})">
    </div>

    </div>
</main>
<footer>

</footer>
</body>
<script src="../js/admin.js"></script>

</html>
